package forces;

import java.awt.Dimension;

import util.Location;
import util.Vector;

/**
 * defines gravity as an extension of Force.
 * @author Schwartz & Roy
 *
 */
public class GravityForce extends Force {

    private Vector gravity;

    /**
     * constructor sets default gravity to 0.
     */
    public GravityForce() {
        this(new Vector(DEFAULT_MAGNITUDE, DEFAULT_EXPONENT));
    }

    /**
     * constructor sets gravity.
     * @param g is the specified gravity
     */
    public GravityForce(Vector g) {
        super();
        gravity = g;
    }

    /**
     * Simple return value dependent on isOn boolean
     * @param massLocation is the location of the mass to which
     *      the force is being applied
     * @param bounds of the simulation
     * @return the force vector for gravity.
     */
    public Vector getForceVector(Location massLocation, Dimension bounds) {
        if (isOn()) {
            return new Vector(gravity);
        }
        return (new Vector());
    }
}
